//jquery popIn
//dependencies : jquery, jquery_std
//usage 1          : popIn(200,200,"content <strong>gras</strong>");
//usage 2 (iframe) : popIn(100,200,"http://www.google.fr");

function popIn(w,h,content,title)
{
    title = title==null ? "" : title;
  if ($("#modal_bg").length!=0)
      closePopIn();
  html='<div id="modal_bg" ></div><div id="modal" style="width:'+w+'px;height:'+h+'px;" >';
  html+='<div id="modal_title" ><a href="#" onclick="closePopIn();" >close</a>'+title+'</div>';
    if (content.substr(0,7)=="http://") {
        html+='<iframe	id="popInContent" name="popInContent" src="'+content+'" ></iframe></div>';
        $("body").append(html); 
    } else {
        html+='<div id="popInContent" >'+content+'</div></div>';
        $("body").append(html);
    }
  $(window).resize(updatePopIn);
  updatePopIn();
}

function closePopIn()
{
    $("#modal_bg").remove();
    $("#modal").remove();
    $(window).unbind("resize",updatePopIn);
}


function updatePopIn()
{
  $('#modal_bg').resizeTo($.windowSize());
  $('#modal_bg').pos($.scrollOffset());
  $('#modal').center();
  $("#mess2").text("upd"+$.windowSize().w);
}
